<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>
<body>
    <div id='app'>
        <p>{{msg}}</p>
        <button @click='start'>开始</button>
        <button @click='stop'>暂停</button>
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg:'乌龟的屁股是个龟腚',
                r:null,
            },
            methods: {
                start(){
                    if(this.r != null) return;
                    this.r=setInterval(()=>{
                        var str1 = this.msg.slice(1)
                        var str2 = this.msg.substr(0,1)
                        this.msg = str1 + str2
                    },500)
                },
                stop(){
                    clearInterval(this.r)
                    this.r = null
                }
            },
        });
    </script>
</body>
</html>